import os

import pytest

from common.utils.parser import code_generate, today
from conf import settings

# allure config...
host, port, tmp_dir, report_dir = settings.ALLURE_HOST, settings.ALLURE_PORT, \
                                  settings.ALLURE_TMP_DIR, settings.ALLURE_REPORT_DIR

if __name__ == '__main__':
    with code_generate(clean=True):
        allure_dir = os.path.join(tmp_dir, today())
        report_dir = os.path.join(report_dir, today())
        pytest.main(["-vs", f"--alluredir={allure_dir}", "--clean-alluredir", ])
        os.system(f"allure generate {allure_dir} --report-dir {report_dir} --clean")
